﻿using System;
using System.IO;

namespace HorrorsOfArkham.Game_Application_Layer
{
    public class SaveFileHandler : FileHandler
    {
        #region Members

        public static readonly SaveFileHandler Instance = new SaveFileHandler();

        private string saveFileDirectory;

        public string SaveFileDirectory
        {
            get
            { return saveFileDirectory; }
        }

        #endregion

        #region Initialization

        protected SaveFileHandler()
        { 
        }

        public bool SetSaveFileDirectory()
        {
            bool setupOK = false;

            string currentDir = Directory.GetCurrentDirectory();

            string newSaveDirectory = currentDir + "\\SaveFiles";

            if (!Directory.Exists(@newSaveDirectory))
            {
                Directory.CreateDirectory(newSaveDirectory);

                if (Directory.Exists(@newSaveDirectory))
                {
                    saveFileDirectory = newSaveDirectory;
                    setupOK = true;
                }
                else
                {
                    setupOK = false;
                }
 
            }
            else 
            {
                saveFileDirectory = newSaveDirectory;
                setupOK = true;
            }

            return setupOK;
        }

        #endregion
    }
}
